The present invention relates to the field of data consistency maintenance and recovery. More particularly, the present invention relates to the maintenance and recovery of valid information in a memory mapped data base utilized by multiple processes operating on a computer system.
Electronic systems and circuits have made a significant contribution towards the advancement of modem society and are utilized in a number of applications to achieve advantageous results. Numerous electronic technologies such as digital computers, calculators, audio devices, video equipment, and telephone systems have facilitated increased productivity and reduced costs in analyzing and communicating data, ideas and trends in most areas of business, science, education and entertainment. Electronic systems designed to provide these results are usually arranged in a variety of complicated configurations governed by processing and communication limitations, including time dependencies and ordering constraints. Typically, electrical systems depend upon consistent or xe2x80x9cvalidxe2x80x9d data to operate properly.
Numerous electrical systems include a variety of processes and frequently different processes attempt to manipulate data at the same time, often resulting in inconsistent (xe2x80x9cinvalidxe2x80x9d) data. For example, if a first process in a computer system accesses xe2x80x9coldxe2x80x9d information that is currently being updated by a second process, the old data may no longer be valid and the first process may produce inaccurate or inappropriate results. In sequential processing and communication systems information is usually divided into units that are transmitted or processed one piece at a time, with one piece of information following another. In some situations it is critical for a first piece of information to follow second piece of information and if the first piece of information is not valid the results are typically unreliable. Maintaining data consistency is particularly important in a computing environment utilizing a database shared by various programs or processes. Processes utilizing a memory mapped data base memory (MDBM) expect that the data they access from a main memory is consistent with the data in a MDBM file and looks the same to any process accessing it. Thus, most computer systems typically require data to be consistent (xe2x80x9ccorrectxe2x80x9d) with respect to a particular point in time.
Computer system crashes or process crashes typically have an adverse affect on data consistency maintenance. If a system or process crashes in the middle of performing a write transaction the resulting data is typically unreliable and often invalid. Maintaining consistency across process transactions is critical for proper recovery from a process or system crash. If a read or write process (or the system that a write is happening on) crashes anytime during the transaction it is important for the consistency (e.g., of a database) to be maintained so that continuing processes receive valid information.
What is required is a system and method that facilitates data consistency maintenance during a write operation. The system and method should also facilitate recovery from a system or process crash with valid data.
The present invention is a system and method that facilitates data consistency maintenance between two segments of memory. In one exemplary implementation, the present invention facilitates consistency maintenance during a write operation to a database. The present invention also facilitates recovery from a system or process crash with valid data. A data consistency maintenance and recovery system and method of the present invention utilizes a dual page configuration and locking process to store and track data. A primary page is utilized as the primary data storage location and a mirror page operates as copy of the primary page except during certain stages of a data manipulation operation (e.g., a write operation). In one embodiment of the present invention, a process can not access a page to perform a read operation if the page is locked and a process can not perform a write operation if the process did not lock the page.
In one embodiment of the present invention, a consistency maintenance locking method and an access tracking method are utilized to facilitate consistency maintenance across multiple instances. The present invention also facilitates recovery from a process or system crash. In one embodiment of the present invention, consistency is maintained across multiple instances of a database and data being manipulated is stored in buckets across multiple pages and referenced by multiple indexes. Read operations access information from unlocked primary pages. Consistency maintenance write operations access, lock and update a mirror page, then access, lock and update a primary page. Primary page and mirror page accesses are tracked (e.g., counted). Then a consistency maintenance write operation unlocks and syncs the primary page to disk as well as the mirror page. A page with consistent data is copied to a page with inconsistent data during a process system crash recovery. In one embodiment of the present invention, a primary page is considered consistent if a write operation has not accessed the primary page to begin a write process, otherwise data on a mirror page is considered consistent. In one embodiment of the present invention, a write operation is dropped or continued upon determination that data is inconsistent when recovering from a process or system crash.